package JET.UtilPanels;

import JET.Centers.Graphics.GUICenter;
import JET.mygui.UtilTabsPane.UtilTabsPaneTab;
import java.awt.Rectangle;


/*
 * UPOutput.java
 *
 * Created on 2010-08-30, 21:54:48
 */



/**
 *
 * @author 057Ry
 */
public class UPOutput extends javax.swing.JPanel implements UtilTabsPaneTab {

    /** Creates new form UPOutput */
    public UPOutput() {
        initComponents();
    }

    public GUICenter.UtilTabs getId() {
        return GUICenter.UtilTabs.Output;
    }

    public boolean isScrollable() {
        return false;
    }

    public void clear() {
        jTextArea1.setText("");
    }
    
    public void print(String s) {
        jTextArea1.append(s);
        scrollViewDown();
    }

    public void println(String s) {
        jTextArea1.append(s+"\n");
        scrollViewDown();
    }

    public void scrollViewDown() {
        jTextArea1.scrollRectToVisible(new Rectangle(0,jTextArea1.getHeight()-1, 1, jTextArea1.getHeight()));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        jButton1.setText("Clear");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jButton1)
                .addContainerGap(302, Short.MAX_VALUE))
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
        );

        getAccessibleContext().setAccessibleName("Output");
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        clear();
    }//GEN-LAST:event_jButton1ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables

}
